package com.ruoyi.project.system.card.card.service.impl;

import javax.annotation.Resource;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.utils.uniquekey.IdGererateFactory;
import com.ruoyi.project.system.card.card.mapper.MemberCardMapper;
import com.ruoyi.project.system.card.card.domain.MemberCard;
import com.ruoyi.project.system.card.card.service.IMemberCardService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 用户提现账户Service业务层处理
 * 
 * @author f_baisi
 * @date 2020-08-26
 */
@Service
public class MemberCardServiceImpl implements IMemberCardService 
{
    @Resource
    private IdGererateFactory idGererateFactory;
    @Autowired
    private MemberCardMapper memberCardMapper;

    /**
     * 查询用户提现账户
     * 
     * @param id 用户提现账户ID
     * @return 用户提现账户
     */
    @Override
    public MemberCard selectMemberCardById(String id)
    {
        return memberCardMapper.selectMemberCardById(id);
    }

    /**
     * 查询用户提现账户列表
     * 
     * @param memberCard 用户提现账户
     * @return 用户提现账户
     */
    @Override
    public List<MemberCard> selectMemberCardList(MemberCard memberCard)
    {
        return memberCardMapper.selectMemberCardList(memberCard);
    }

    /**
     * 新增用户提现账户
     * 
     * @param memberCard 用户提现账户
     * @return 结果
     */
    @Override
    public int insertMemberCard(MemberCard memberCard)
    {
        memberCard.setId(this.idGererateFactory.nextStringId());
        return memberCardMapper.insertMemberCard(memberCard);
    }

    /**
     * 修改用户提现账户
     * 
     * @param memberCard 用户提现账户
     * @return 结果
     */
    @Override
    public int updateMemberCard(MemberCard memberCard)
    {
        return memberCardMapper.updateMemberCard(memberCard);
    }

    /**
     * 删除用户提现账户对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteMemberCardByIds(String ids)
    {
        return memberCardMapper.deleteMemberCardByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用户提现账户信息
     * 
     * @param id 用户提现账户ID
     * @return 结果
     */
    @Override
    public int deleteMemberCardById(String id)
    {
        return memberCardMapper.deleteMemberCardById(id);
    }

    @Override
    public int removeDefault(String memberId, int i) {
        return this.memberCardMapper.removeDefault(memberId,i);
    }
}
